<template>
  {{ obj }} <br />

  <button @click="addObj">添加</button>
  <button @click="delFun">删除</button>
  <button @click="changeFun">更新</button>
</template>

<script setup lang="ts">
import { ref } from "vue";

let obj = ref({
  name: "Jock_Fang",
  age: 18,
});

function addObj() {
  //-- 添加
  obj.value.address = "Fujian, Xiame";
  console.log(JSON.stringify(obj), "添加 address");
}

//-- 删除
function delFun() {
  delete obj.value.name;
  console.log(JSON.stringify(obj), "删除 name");
}

//-- 修改
function changeFun() {
  obj.value.age = 41;
  console.log(JSON.stringify(obj), "修改 age");
}
</script>

<style scoped>
button {
  margin: 0 10px;
}
</style>